using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using AntDesign;
using AntDesign.Charts;
using AntDesign.ProLayout;
using System.Net.Http;
using System.Net.Http.Json;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Http;
using Microsoft.JSInterop;
using ZFY.UMC.BlazorWebAssembly;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using ZFY.UMC.BlazorWebAssembly.Shared;
using Microsoft.AspNetCore.Components.Authorization;
using ZFY.Core;
using System.ComponentModel.DataAnnotations;
using ZFY.UMC.Model.Dto.User;
using ZFY.UMC.BlazorWebAssembly.HttpServices;

namespace ZFY.UMC.BlazorWebAssembly.Pages.Auth
{
    public partial class Register
    {
        [Inject]
        public CommonService CommonService { get; set; }

        private UserRegisterInput _model = new UserRegisterInput();

        AntDesign.Form<UserRegisterInput> _registerForm;

        private bool _auto = false;

        List<NestedModel> _provinces = new List<NestedModel>();
        List<NestedModel> _cities = new List<NestedModel>();
        List<NestedModel> _counties = new List<NestedModel>();

        protected override async Task OnInitializedAsync()
        {

            _provinces = await CommonService.GetProvinceListAsync();

            Console.WriteLine(_provinces is null);
        }

        private void OnProvinceSelectedItemChanged(NestedModel value)
        {
            if (value != null)
                _cities = value.Children;
        }
        private void OnCitySelectedItemChanged(NestedModel value)
        {
            if (value != null)
                _counties = value.Children;
        }
    }
}